import axios from 'axios';

export function request(config) {
  return new Promise((resolve, reject) => {
    //创建实例
    var instance = axios.create({
      baseURL: 'http://152.136.185.210:8000/api/w6',
      timeout: 5000,
    });

    //添加请求拦截器
    instance.interceptors.request.use(config =>{

      return config;
    }, err => {
      return err;
    });

    //响应式拦截器
    instance.interceptors.response.use(config => {

      return config;
    }, err => {
      return err;
    });

    instance(config)
      .then(res => {
        return resolve(res);
      }).then(err => {
        return reject(err);
    });
  });
};
